import Vue from 'vue'
import App from './App.vue'
import router from './router'
import 'element-ui/lib/theme-chalk/index.css';
import '../src/assets/css/global.css';
import NProgress from 'nprogress'
import VueLazyLoad from 'vue-lazyload'
// import Vuex from 'vuex'
import store from './store'
import {
    Form,
    FormItem,
    Input,
    Button,
    Radio,
    Container,
    Aside,
    Menu,
    Header,
    MenuItem,
    Dialog,
    Submenu,
    Row,
    Col,
    Main,
    Footer,
    Option,
    Carousel,
    CarouselItem,
    Breadcrumb,
    BreadcrumbItem,
    Card,
    Table,
    TableColumn,
    Select,
    RadioGroup,
    Divider,
    Message,
    MessageBox,
    Upload,
    Image,

} from 'element-ui';

Vue.use(Form);
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Button)
Vue.use(Radio)
Vue.use(Container)
Vue.use(Aside)
Vue.use(Menu)
Vue.use(Header)
Vue.use(MenuItem)
Vue.use(Dialog)
Vue.use(Submenu)
Vue.use(Row)
Vue.use(Col)
Vue.use(Main)
Vue.use(Footer)
Vue.use(Option)
Vue.use(Carousel)
Vue.use(CarouselItem)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Card)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Select)
Vue.use(RadioGroup)
Vue.use(Divider)
Vue.use(Upload)
Vue.use(Image)
    // Vue.use(Vuex)
Vue.use(VueLazyLoad, {
    preLoad: 1, //预加载高度的比例
    error: '', //图像的src加载失败
    loading: '', //src的图像加载
    attempt: 1, //尝试计数
    listenEvents: ['scroll', 'mousewheel'] //你想要监听的事件,我个人喜欢全部监听，方便
});

Vue.prototype.$message = Message;
Vue.prototype.$confirm = MessageBox.confirm;


import axios from 'axios'
//配置请求的根路径
axios.defaults.baseURL = 'http://100.2.237.253:8080/v1'
    // 在request 拦截器中，展示进度条 用NProgress.start()
axios.interceptors.request.use(config => {
        NProgress.start();
        // 拦截token
        config.headers.token = window.sessionStorage.getItem('token');
        return config
    })
    //在response 拦截器中，隐藏进度条 用 NProgress.done()
axios.interceptors.response.use(config => {
    NProgress.done();
    return config
})
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')